/**
 * 小区回填列表
 */

$(function(){
	//实现回填列表数据搜索
	$('div span.btn_search').click(function(){
		var data =communityList.data;
		data.name =  $('#hidden_name').val();
		getPopTablePageData(data);
	});
	
	//实现分页条件查询
	console.log('popCommunityListTableDiv');
	$('#popCommunityListTableDiv div.my-pagination > div > a').click(function(){
		var data =communityList.data;
		data.name =  $('#hidden_name').val();
		var href = $(this).attr('href');
		//截取href中#之后的值
		var str = href.substring(1,href.Length);
		data.page=parseInt(str);
		getPopTablePageData(data);
	});
	$('#popCommunityListTableDiv div.my-pagination .page-current').change(function(){
		var data =communityList.data;
		data.name =  $('#hidden_name').val();
		var page = $(this).val();
		data.page=parseInt(page);
		getPopTablePageData(data);
	});
	adjustTableCellWidth('popCommunityListTableDiv');

	//获取回填数据
	$('table.community_backfill > tbody > tr ').click(function(){
		var data =communityList.data;
		data.id = $(this).find(':input[type=radio]').val();
		data.name = $(this).find('td:eq(1)').html();
		communityList.backfillFun(data);
		layer.closeAll();
	});
});

function getPopTablePageData(data){
	doDataPost(data, false, ctx+"/common/community/backfill", function(msg){
		$($('.layui-layer-content')[0]).empty();
		$($('.layui-layer-content')[0]).append(msg);
		layer.iframeAuto(indexLayer);
	});
}
